var tableData = {
	url : ctp + "/sysuserController/userSearch.shtml",
	propertys : [ "USER_LOGINCODE", "USER_NAME" ,"PHONE","STATE" ],
	hidden : [ "userId=USER_ID" , "userLoginCode=USER_LOGINCODE"],
	hrefs : [ [ "function=userUpdate", "recId=REC_ID", "修改", null ],[ "function=grantAuth", "userId=USER_ID", "授权", null ] ],
	//links:[["function=gotoPage","code=USER_LOGINCODE","0"]],//列表中第一列的点击方法
	css:[null,null,null,null,"[STATE_CHAR][1=color:blue;,2=color:red;]"],//不同值的样式
	maxLength:["TASKNAME=15"],
	//events:["onClick=loadDetails(USER_LOGINCODE)"],//每一行的点击方法
	opers:true,//操作是否显示
	checkBox:["REC_ID",true],//列表复选
	values:["MATERIAL_SIZE=sizeFormate"],
	//radio:["REC_ID",true], //列表单选
	startLoad : function() {
		getListData(this);
	}
};


function searchData(curr) {
	setTagAndValue("form1", "curr", curr);
	tableData.startLoad();
}
$(document).ready(function() {
	//页面中下拉框的渲染
	$('select').SumoSelect({
	placeholder: '请选择',
    csvDispCount: 4,
    captionFormat: '{0} Selected',
    forceCustomRendering: false,
    outputAsCSV : false,
    okCancelInMulti: false, 
    triggerChangeCombined : true
	});
	//页面加载时，加载列表
	searchData();

});



function userDel() {
	var recIds = getCheckIds();
	if (recIds == '') {
		jalert("请选择要删除的记录！");
		return false;
	}
	jconfirm("del('" + recIds + "')", "是否要删除所选记录？");
}
function del(recIds) {
	$.ajax({
		url : ctp + "/sysuserController/userDelete.shtml",
		data : {
			recIds : recIds
		},
		type : 'POST',
		async : false,
		success : function(result) {
			if (result == "") {
				jalert("删除成功！");
				var curr = "1";
				if ($("#form1").find("#curr").length > 0) {
					curr = $("#curr").val();
				}
				searchData(curr);
			} else {
				jalert(result);
			}
		}
	});
}

// 修改
function userUpdate(recId) {
	dialogWin(550, 450, ctp + "/sysuserController/userUpdate.shtml?recId="
			+ recId, "");
}
// 新增
function userAdd() {
	dialogWin(550, 450, ctp + "/sysuserController/userAdd.shtml", "");
}
// 授权
function grantAuth(USER_ID) {
	dialogWin(600, 450, ctp + "/sysuserController/grentPage.shtml?userId="
			+ USER_ID, "");
}

// 重置密码
function resetPwd() {
	var recIds = getCheckIds(null, "userLoginCode");
	if (recIds == '') {
		jalert("请选择记录！");
		return false;
	}
	jconfirm("doReset('" + recIds + "')", "确定要重置所选用户的密码吗？");
}

function doReset(recIds) {
	$.ajax({
		url : ctp + "/sysuserController/resetPwd.shtml",
		data : {
			recIds : recIds
		},
		type : 'POST',
		async : false,
		success : function(result) {
			jalert9(result);
			setTimeout(function() {
				searchData();
			}, 1000);
		}
	});
}


function userDisable() {
	var recIds = getCheckIds();
	if (recIds == '') {
		jalert("请选择要停用的用户！");
		return false;
	}
	jconfirm("Disable('" + recIds + "')", "是否要停用所选的用户？");
}
function Disable(recIds) {
	$.ajax({
		url : ctp + "/sysuserController/userDisable.shtml",
		data : {
			recIds : recIds
		},
		type : 'POST',
		async : false,
		success : function(result) {
			if (result=='1') {
				jalert9("停用用户成功！");
				setTimeout(function(){
					searchData();
				}, WARN_TIME_OUT);
			} else {
				jalert("停用用户失败！");
			}
		}
	});
}

function userEnable() {
	var recIds = getCheckIds();
	if (recIds == '') {
		jalert("请选择要启用的用户！");
		return false;
	}
	jconfirm("Enable('" + recIds + "')", "是否要启用所选的用户？");
}
function Enable(recIds) {
	$.ajax({
		url : ctp + "/sysuserController/userEnable.shtml",
		data : {
			recIds : recIds
		},
		type : 'POST',
		async : false,
		success : function(result) {
			if (result=='1') {
				jalert9("启用用户成功！");
				setTimeout(function(){
					searchData();
				}, WARN_TIME_OUT);
			} else {
				jalert("启用用户失败！");
			}
		}
	});
}


//导出系统用户
function sysuserExportConfirm(recId){
	var formSerialize =$("#form1").serialize();
	jconfirm("exportSysUser('"+formSerialize+"')","确认要导出系统用户信息吗？");	
}
function exportSysUser(formSerialize){
	location.href=ctp+"/sysuserController/exportSysUser.shtml?"+formSerialize;
}


//用户信息导入界面跳转
function sysuserImportpage(){
	dialogWin(550,450,ctp+"/sysuserController/sysuserImportpage.shtml","用户信息导入");
}
























